<?php
require_once 'classes/photos.php';
require_once 'classes/mySession.php';

if(!$pgSession->isUserLoggedIn()){
	$retorno = array("status"=>FALSE,"message"=>"No user logged in.");
}else{
	$ownerN = $pgSession->getUserId();
	$idN = $_GET["photoid"];
	$text = $_GET["description"];
	
	if(isset($idN) && !is_null($idN)
			&& isset($text) && !is_null($text)){
		
		$p = new Photo($idN, $ownerN, NULL, NULL, NULL);
		$p->setText($text);
		
		$resp = $photoUtils->savePhoto($p);
		
		echo json_encode($resp);
	}
}

#CHECK SESSION TO USER ALREADY LOGGED IN

#IF NOT, REDIRECT TO LOGIN PAGE

#IF YES:
#	CHECK IF LAT AND LONG ARE VALID
#	IF YES:
#		CONNECT TO DATABASE
#		CHECK IF PHOTO ID IS VALID
#		TRY TO SAVE ON EXIF
#		TRY TO SAVE IN DATABASE
#		IF SAVED IN DATABASE, RETURN JSON WITH MESSAGE AND LOCATION
#	IF NOT, RETURN JSON WITH MESSAGE
?>